#ifndef SYNCHRONOUSAV_H
#define SYNCHRONOUSAV_H

#include "synimagehandler.h"
#include "Task_Base/Task_Base.h"
class MediaImagehandler;
class TimerSynchAbstract;
class SynchronousAV : public Task_Base,public SynImagehandler
{

public:
    SynchronousAV();
    ~SynchronousAV();
public:
    void init(MediaImagehandler *,TimerSynchAbstract *);
public:
    virtual bool syn_image_handler(unsigned char *data,int size,double pts,int width, int height);
public:
    virtual int close();
protected:
    virtual int svc();
private:
    int syn_image_audio(unsigned char *data,int size,double pts,int width, int height);
private:
    TimerSynchAbstract     *m_oSynchtarget;
    MediaImagehandler      *show_image_handler;

    CCriticalSection       *oSynchCriSection;
private:
    double       frame_last_pts;     //记录上次图片的pts
    double       frame_last_duration;   //记录上次图片播放时 延时长度
    double       frame_timer;
    double       timer;
};

#endif // SYNCHRONOUSAV_H
